package com.tcs.message;

import org.apache.kafka.clients.consumer.ConsumerRecord;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.kafka.listener.AcknowledgingMessageListener;
import org.springframework.kafka.support.Acknowledgment;

/**
 * Kafka message customer
 * @author 神经刀
 */
public class KafkaMessage implements AcknowledgingMessageListener<String,String> {
	
	private final Logger logger = LoggerFactory.getLogger(KafkaMessage.class);

	@Override
	public void onMessage(ConsumerRecord<String, String> data, Acknowledgment acknowledgment) {
		logger.debug("topic : {} , partition : {} , offset : {} , key : {} , value : {}" , data.topic() , data.partition() , data.offset() , data.key() , data.value());
		logger.info(data.value());
		acknowledgment.acknowledge();
	}
}